function login() {
    //获取登录数据
    let username = $("#username").val();
    let password = $("#password").val();
    if (username != "" && password != "") {
        //将数据转发给后台
        let data = {
            "username": username,
            "password": password
        };
        let result = myAjax("/user/login", "post", data, 'json');
        if (result.code == 200) {
            let user = result.model["user"];
            console.log(user);
            sessionStorage.setItem("user", JSON.stringify(user));
            sessionStorage.setItem("username", username);
            alert("登录成功");
            window.location.href = "../html/home.html";
        } else {
            alert("登录信息输入错误，请重新输入");
        }
    }
}